#include <bits/stdc++.h>
using namespace std;
int n;
int a[100005];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for (int i = 1;i <= n; i++)
        scanf("%d",a+i);
    sort(a+1,a+1+n);
    a[n + 1] = -1;
    int l = 1,r=0;
    int ans = n;
    int cnt = 0;
    while(a[r + 1] == a[l])r++;
    cnt = r-l+1;
    l = r+1;
    while(l <= n)
    {
        while(a[r + 1] == a[l])r++;
        int z = r-l+1;
        ans -= min(z,cnt);
        cnt = max(z,cnt);
        l = r + 1;
    }
    printf("%d",ans);
    return 0;
}
